<!-- 收银台 -->
<template>
	<view>
		<view class="bg-white ss-modal-box ss-flex-col">
			<view class="modal-header ss-flex-col ss-col-center ss-row-center">
				<view class="money-box ss-m-b-20">
					<text class="money-text">{{ state.orderInfo.pay_fee }}</text>
				</view>
				<view class="time-text">
					<text>{{ payDescText }}</text>
				</view>
			</view>
			<view class="modal-content ss-flex-1">
				<view class="pay-title ss-p-l-30 ss-m-y-30">选择支付方式</view>
				<radio-group @change="onTapPay">
					<label class="pay-type-item" v-for="item in state.payMethods" :key="item.title">
						<view class="pay-item ss-flex ss-col-center ss-row-between ss-p-x-30 border-bottom"
							:class="{ 'disabled-pay-item': item.disabled }" v-if="allowedPayment.includes(item.value)">
							<view class="ss-flex ss-col-center">
								<image class="pay-icon" :src="item.icon" mode="aspectFit">
								</image>
								<text class="pay-title">{{ item.title }}</text>
							</view>
							<view class="check-box ss-flex ss-col-center ss-p-l-10">
								<view class="userInfo-money ss-m-r-10" v-if="item.value == 'money'">
									余额: {{ userInfo.money }}元
								</view>
								<view class="userInfo-money ss-m-r-10" v-if="item.value == 'offline' && item.disabled">
									部分商品不支持
								</view>
								<radio :value="item.value" color="var(--ui-BG-Main)" style="transform: scale(0.8)"
									:disabled="item.disabled" :checked="state.payment === item.value" />
							</view>
						</view>
					</label>
				</radio-group>
			</view>
			<!-- 工具 -->
			<view class="modal-footer ss-flex ss-row-center ss-col-center ss-m-t-80 ss-m-b-40">
				<button v-if="state.payStatus === 0" class="ss-reset-button past-due-btn">
					检测支付环境中
				</button>
				<button v-else-if="state.payStatus === -1" class="ss-reset-button past-due-btn" disabled>
					支付已过期
				</button>
				<button v-else class="ss-reset-button save-btn" @tap="onPay" :disabled="state.payStatus !== 1"
					:class="{ 'disabled-btn': state.payStatus !== 1 }">
					立即支付
				</button>
			</view>
		</view>
	</view>
</template>
<script>
	var app = getApp();
	export default {
		data() {
			return {
				payDescText:'剩余支付时间：21:00:00',
				allowedPayment:['alipay','wxpay','money'],
				userInfo:{
					money:123
				},
				state: {
					active: 1,
					orderInfo: {
						pay_fee:1,
						jijiancg: '1',
						facity: '',
						fuser: '',
						jaddress:'',
						jmobile: '',
						shoucity: '',
						suser: '',
						saddress:'号',
						smobile: '',
						order_sn: '',
						create_time_text: '',
						zhongl: '',
						shijzl: '',
						chaj: '',
						jijianm:'',
						wupin:'',
						shuliang:'',
						yuyueshjstart:'',
						yuyueshjstop:'',
						tiji:'1',
						zhongliang:''
					},
					guiji: [
						'上饶',
						'南昌'
					],
					payment:'',
					payStatus:'',
					payMethods:[{
						value:'wxpay',
						title:'微信支付',
						disabled:false,
						icon:'https://kuaidi.suchenqiang.cn/assets/addons/shopro/uniapp/pay/wechat.png'
					},
					{
						value:'money',
						title:'余额支付',
						disabled:false,
						icon:'https://kuaidi.suchenqiang.cn/assets/addons/shopro/uniapp/pay/wallet.png'
					}]
				}
			}
		},
		onLoad: function(opt) {},
		methods: {
			toAddPage() {

			},
			bindChange() {

			}
		}
	};
</script>

<style lang="scss" scoped>
	.pay-icon {
		width: 36rpx;
		height: 36rpx;
		margin-right: 26rpx;
	}

	.ss-modal-box {
		// max-height: 1000rpx;

		.modal-header {
			position: relative;
			padding: 60rpx 20rpx 40rpx;

			.money-text {
				color: red;
				font-size: 46rpx;
				font-weight: bold;
				font-family: OPPOSANS;

				&::before {
					content: '￥';
					font-size: 30rpx;
				}
			}

			.time-text {
				font-size: 26rpx;
				color:gray;
			}

			.close-icon {
				position: absolute;
				top: 10rpx;
				right: 20rpx;
				font-size: 46rpx;
				opacity: 0.2;
			}
		}

		.modal-content {
			overflow-y: auto;

			.pay-title {
				font-size: 26rpx;
				font-weight: 500;
				color: #333333;
			}

			.pay-tip {
				font-size: 26rpx;
				color: #bbbbbb;
			}

			.pay-item {
				height: 86rpx;
			}

			.disabled-pay-item {
				.pay-title {
					color: #999999;
				}
			}

			.userInfo-money {
				font-size: 26rpx;
				color: #bbbbbb;
				line-height: normal;
			}
		}

		.save-btn {
			width: 710rpx;
			height: 80rpx;
			border-radius: 40rpx;
			background: linear-gradient(90deg, var(--ui-BG-Main), var(--ui-BG-Main-gradient));
			color: white;
		}

		.disabled-btn {
			background: #e5e5e5;
			color: #999999;
		}

		.past-due-btn {
			width: 710rpx;
			height: 80rpx;
			border-radius: 40rpx;
			background-color: #999;
			color: #fff;
		}
	}
	.ss-row-center {
	    justify-content: center;
	}
	.ss-col-center {
	    align-items: center;
	}
	.ss-flex-col {
	    display: flex;
	    flex-direction: column;
	}
	.ss-m-b-20 {
	    margin-bottom: 20rpx;
	}
	.ss-flex-1 {
	    flex: 1;
	}
	.ss-p-l-30 {
	    padding-left: 30rpx;
	}
	.ss-m-y-30 {
	    margin-top: 30rpx;
	    margin-bottom: 30rpx;
	}
	
	[class*=border] {
	    position: relative;
	}
	.ss-p-x-30 {
	    padding-left: 30rpx;
	    padding-right: 30rpx;
	}
	.ss-row-between {
	    justify-content: space-between;
	}
	.ss-flex {
	    display: flex;
	    flex-direction: row;
	    align-items: center;
	}
	.bg-white {
	    background-color: #ffffff !important;
	    color: #333333 !important;
	}
	
	.ss-m-t-80 {
	    margin-top: 80rpx;
	}
	.ss-m-b-40 {
	    margin-bottom: 40rpx;
	}
</style>